// *************************************
// EFMP Fleet
// EFMP_fleet_regs.do
// *************************************

/*
// Description
// ----------------------------
This program analyses the Enhanced Fleet Modernization Program (EFMP) in 
California.  It performs a diff-in-diff, matched diff-in-diff and triple difference (TD) analysis on merged Experian 
fuel efficiency moments. 
*/

/* Main Analysis */

** Run a loop through the outcome variables, with which we run the main analysis and robustness checks. 

* Main Specification: gpm 

* Robustness check: gpmO "Optimistic" GPM  with regards to the PHEV/HEV and BEV/HEV shares
* Robustness check: gpmP "Pessimistic" GPM with regards to the PHEV/HEV and BEV/HEV shares
* Robustness check: gpmR Drop non-DAC tracts that overlap with DAC Zips.
* Robustness check: gpmR2 drops BMW I3 (due to inability to differentiate between BEV and BEVx, range extender)

local outvarlist "gpm" 
foreach outvar_i of local outvarlist {
	global outvarGlobal "`outvar_i'"
	if "`outvar_i'" == "gpm" {
		global outputSubfolder "MainResults"
	}
	else {
		global outputSubfolder "`outvar_i'"
	}
	
	/*Match DAC / non-DAC zips in AQMD = 1 to zips with similar pre-trends in AQMD = 0 */
	do "${EFMPFleetCode}/EFMP_NNMatch.do"

	* run regressions and create tables
	do "${EFMPFleetCode}/EFMP_TripleDiff_nn.do"
		**Note: This calls EFMP_ConstructIVMatch.do
}		

/*Appendix Robustness Checks*/

local outvarlist "gpmO gpmP gpmR gpmR2"
foreach outvar_i of local outvarlist {
	global outvarGlobal "`outvar_i'"
	if "`outvar_i'" == "gpm" {
		global outputSubfolder "MainResults"
	}
	else {
		global outputSubfolder "`outvar_i'"
	}
	
	do "${EFMPFleetCode}/EFMP_NNMatch.do"

	* run regressions and create tables
	do "${EFMPFleetCode}/EFMP_TripleDiff_nn.do"
		**Note: This calls EFMP_ConstructIVMatch.do
}		

